
#include <cm/character/character.h>
#include <stdio.h>
#include <string.h>

int main()
{
	char utf8[10] = "你好";
	char ch[256] = { 0 };
	size_t s = sizeof(utf8);
	size_t d = sizeof(ch);
	char *src = utf8;
	char *dst = ch;
	int ret = UTF82GB2312(&src, &s, &dst, &d);
	printf("UTF 2 GB2312: %d\n", ret);

	int i;
	for (i = 0; utf8[i] != 0; i++) {
		printf("%.2x ", (unsigned char) utf8[i]);
	}
	printf("\n");

	for(i = 0; ch[i] != 0; i++) {
		printf("%.2x ", (unsigned char)ch[i]);
	}
	printf("\n");
}
